home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / cdda_mpeg_op5 / arexx / PlayHifi_DT.dopus5 < prev    next >
Text File  |  1995-12-23  |  5KB  |  165 lines

  1. /* Programm: PlayHifi_DT.dopus5
  2. ** $VER: PlayHifi_DT.dopus5 1.3 (27-Dec-95)
  3. **
  4. ** 
  5. ** Needed: Directory Opus V5.xx (© by Jonathan Potter & GPSoftware)
  6. **         mpega (© 1995 by Stephane Tavenard) or/and 
  7. **         PeggyPlus MPEG-Card (© Ingenierbuero Helfrich)
  8. **         PeggyPlus:MPEGPlayer >= V4.7
  9. **         Play16 (© 1995 by Thomas Wenzel)
  10. **         PlayADPCM (Autor Christian Buchner)
  11. **
  12. ** Copyright © 1995 Eckhard Ludwig (Eckhard@top.east.de)
  13. ** PlayHifi_DT.dopus5 is freeware. It may be distributed freely.
  14. **
  15. ** Play compressed sound (MPEG Layer 1&2) from DOpus5. Only for DOpus5-filetypes,
  16. ** New: Play AIFF, WAVE, 8SVX, VOC, ADPCM3 (set filetypes doubleclick).
  17. **
  18. ** Localecatalog for german & more: used catalog "PlayHifi.dopus5" !
  19. **
  20. **
  21. ** Call as:
  22. ** --------------------------------------------------------------------------
  23. ** (Doubleklick)   ARexx DOpus5:ARexx/PlayHifi_DT.dopus5 {f} {Qp} {Ql}
  24. ** --------------------------------------------------------------------------
  25. ** Set Attribut: "Output to window" (Ausgabe in Fenster).
  26. ** Set Attribut: "Run asynchron" (Asynchroner Start)
  27. **
  28. */
  29.  
  30. /*--------S E T T I N G S : -------------------------------------------*/
  31. /* If the file ENV:PlayHifi.PREFS exists, that one will override the   */
  32. /* settings here ...                                                   */
  33.  
  34. /*- Path to Player command --------------------------------------------*/
  35. Play16 = "C:Play16"
  36. PL16_OPTIONS=" Paula14 FILTER=OFF"
  37.  
  38. PlayADPCM = "C:PlayADPCM"
  39.  
  40. /*- Path to MPEGPlayer command ----------------------------------------*/
  41. PlayMPEG = "C:mpega"   /* Softwareplayer */
  42. MPEGA_OPTIONS=" -p -f0 -d2 -q2 "
  43.  
  44.  
  45. parse arg '"' Titel '"' portname handle
  46.  
  47. if portname='' then
  48.    portname='DOPUS.1'
  49. address value portname
  50.  
  51. options results
  52. options failat 21
  53. lf='0a'x
  54.  
  55. Index  = 'T:PlayDOpus5Index.temp' /*Name entspricht PlayHifi.dopus5 !*/
  56.  
  57. if open(1,'env:PlayHifi.prefs','R') then do
  58.    do i=1 to 6
  59.     prefs.i = readln(1)
  60.         end
  61.    if prefs.2 ~="" then PLAY16=prefs.2
  62.    if prefs.3 ~="" then PlayADPCM=prefs.3
  63.    if prefs.4 ~="" then PlayMPEG=prefs.4
  64.    if prefs.5 ~="" then PL16_OPTIONS=prefs.5
  65.    if prefs.6 ~="" then MPEGA_OPTIONS=prefs.6
  66.    drop prefs.
  67.    call close(1)
  68.    end
  69.  
  70. if ~show('l','rexxsupport.library') then
  71.     call addlib('rexxsupport.library',0,-30,0)
  72.  
  73. /* init locale */
  74. if ~show(l,'locale.library') then
  75.         call addlib('locale.library',0,-30)
  76. if show(l,'locale.library') then
  77.         catalog=opencatalog('PlayHifi.catalog','english',0)
  78.  
  79. if exists(Index) then do 
  80.    if ~delete(Index) then do
  81.        dopus front 
  82.        dopus request '"'getcatstr(14,'Songs added to playlist ?')'"' 'OK|'getcatstr(1,'Abort')
  83.        if RC=0 then exit
  84.           Index=Index||'1'
  85.           if exists(Index) then call open('output',Index,'A')
  86.        else do
  87.           if open('output',Index,'w') ~=1 then do
  88.              dopus request '"'getcatstr(3,'Error:'lf'Load script in to editor and set path to Index !')'"' getcatstr(1,'Quit')
  89.              exit
  90.              end
  91.        end
  92.    APOS=lastpos("/",Titel)
  93.    if APOS=0 then APOS=lastpos(":",Titel)   
  94.    songname=substr(Titel,APOS+1)
  95.    lister query handle entry '"'songname'"' stem fileinfo.
  96.    call writeln('output',Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment)
  97.    call close('output')
  98.    exit
  99.    end
  100. end
  101.  
  102. dopus getfiletype '"'Titel'"' id
  103. DT=result
  104. if DT="MP2" then do
  105.    if showlist("A","PEGGYPLUS")=1 then do
  106.       if ~show('P','Peggy') then do
  107.     call pragma('STACK',8192)
  108.         address command
  109.         'run >NIL: <NIL: PEGGYPLUS:MPEGPlayer'
  110.         'waitforport Peggy'
  111.         address value portname
  112.         dopus front
  113.       end
  114.    end
  115.     if show('P','Peggy') then do
  116.       address 'Peggy'
  117.       open '"'Titel'"'
  118.       setwindow XOFF 0 YOFF 0 WIDTH 1 HEIGHT 1 XPIC 0 YPIC 0
  119.       Play async
  120.       end
  121.    else do
  122.            if ~exists(PlayMPEG) then do
  123.              dopus front
  124.              dopus request '"'getcatstr(9,'Error:'lf'MPEG-Player not found !'lf'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(1,'Quit')
  125.               exit
  126.              end
  127.       address command PlayMPEG" "MPEGA_OPTIONS" " '"'Titel'"'
  128.       end
  129. exit
  130. end
  131.  
  132. if DT="ADPCM3" then do
  133.     if ~exists(PlayADPCM) then do
  134.           dopus front
  135.           dopus request '"'getcatstr(10,'Error:'lf'ADPCM-Player not found !'lf'path to command: '"'%s'"'',PlayADPCM)'"' getcatstr(1,'Quit')
  136.           end
  137.    else address command PlayADPCM '"'Titel'"' " NOFILTER"
  138.    exit
  139. end
  140.  
  141. if ~exists(Play16) then do
  142.           dopus front
  143.           dopus request '"'getcatstr(11,'Error:'lf'Play16 not found !'lf'path to command: '"'%s'"'',Play16)'"' getcatstr(1,'Quit')
  144.       exit
  145.           end
  146. select
  147.    when DT="CDR" then address command Play16 '"'Titel'"' " RAW FREQ=44100 TRACKS=2 BITS=16 INTEL VERBOSITY=1 "PL16_OPTIONS
  148.    when DT="WAVE" then address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  149.    when DT="AIFF" then address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  150.    otherwise address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  151. end
  152. exit
  153.  
  154. /*--------------------------------------------------------------------------------*/
  155. getcatstr:
  156.    parse arg msgno,msgstring,insert.1,insert.2
  157.    if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring)
  158.    j=0
  159.    do while pos('%s',msgstring)>0
  160.       parse var msgstring fore '%s' aft
  161.       j=j+1
  162.       msgstring=fore||insert.j||aft
  163.       end
  164.    return msgstring
  165.